package com.fanpan26.source.queue;

/**
 * @author fanpan26
 */
public class LinkedReverse {
    static class Node{
        Node(int value){
            this.value = value;
        }
        Node next;
        int value;

        @Override
        public String toString(){
            return value+"";
        }
    }

    Node head;


    public static void main(String[] args) {
        LinkedReverse reverse = new LinkedReverse();
        reverse.head = new Node(1);
        reverse.head.next = new Node(2);
        reverse.head.next.next = new Node(3);
        reverse.head.next.next.next  = new Node(4);
        reverse.head.next.next.next.next  = new Node(5);
        reverse.head.next.next.next.next.next = new Node(6);
        reverse.head.next.next.next.next.next.next = new Node(7);



        Node head = reverse.reverse(reverse.head);

        ThreadLocal<String> thread = new ThreadLocal<>();
        thread.set("aa");
        thread.get();


    }

    public Node reverse(Node node){
        Node pre = null;
        Node next;
        while (node!=null){
           next = node.next;
           node.next = pre;
           pre = node;
           node = next;
        }

        return pre;
    }
}
